<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of HouseModel
 *
 * @author yaoyunhua
 */
namespace Admin\Model;
use Think\Model\RelationModel;

class AirwayDetailModel  extends RelationModel {
    //put your code here
    protected  $tableName = 'airway_detail';

    public function add($dataList,$airId) {
        $airwayData = array();
        $curTime = time();
        foreach ($dataList as $data) {
            $data['air_id'] = $airId;
            $data['reach_date'] = strtotime($data['reach_date']);
            $data['add_time'] = $curTime;
            $airwayData[] = $data;
        }
        if ($dataList) {
            $this->where(array('air_id' => $airId))->delete();
            return parent::addAll($airwayData);
        }
        return false;
    }
}